#include <complex>
#include <fftw3.h>
#include <iostream>
using namespace std;


int main(int argc, char* argv[])
{
  	int N = 10;
    complex<double> *in, *out;
    fftw_plan p;
    in = new complex<double>[N];
    out = new complex<double>[N];

	for(int i = 0; i < N; i++)
	{
	  in[i].real() = double(i);
	  in[i].imag() = 0.0;
	}
    p = fftw_plan_dft_1d(N, reinterpret_cast<fftw_complex*>(in), 
		reinterpret_cast<fftw_complex*>(out), FFTW_FORWARD, FFTW_ESTIMATE);
    fftw_execute(p); /* repeat as needed */
	for(int i = 0; i < N; i++)
	{
	  cout << out[i] << endl;
	}
    fftw_destroy_plan(p);

#ifdef FORCXX
//	fftw_complex *c;
//	complex<double>* d;
//	d = new complex<double>;
//	*d= (1.0, 0.0);
//	cout << endl;
//	cout << *d << endl;
//	c = reinterpret_cast<fftw_complex*>(d);
//	cout << *c[0] << *c[1] << endl;
//	delete d;
//	fftw_free(c);
#endif
	complex<double> a(1.0, 0.0), b, c;
	b.real() = 3.0;
	b.imag() = 2.0;
	cout << complex<double>(3.0,1.0) + complex<double>(2.0, 4.0) << endl;
    cout << a << " " << b << endl;
	fftw_free(in); fftw_free(out);
}

